<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>博客登录</title>
	<link th:href="@{/webjars/bootstrap/4.3.1/css/bootstrap.css}" rel="stylesheet">
	<link th:href="@{/font-awesome-4.7.0/css/font-awesome.min.css}" rel="stylesheet">
	<link rel="stylesheet" href="http://at.alicdn.com/t/font_1643567_yxz5icboc4.css">
	<link rel="stylesheet" href="http://at.alicdn.com/t/font_8d5l8fzk5b87iudi.css">
	<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
	<link th:href="@{/css/sign.css}" rel="stylesheet">
</head>

<body class="text-center">
	<form class="form-signin" th:action="@{/blog}" method="post">
		<img class="mb-4"  th:src="@{/img/photo.jpg}" width="160" height="160">
		<h4 class="h4 mb-3 font-weight-normal">
			<div>
				<a href="/sign_in" th:text="#{login.signIn}">sign in</a>
				<b>·</b>
				<a href="/sign_up" th:text="#{login.signUp}">sign up</a>
			</div>
		</h4>
		<p style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
		<label class="sr-only" th:text="#{login.username}">Username</label>
		<input type="text" class="form-control" name="username"
			   th:placeholder="#{login.username}" required="" autofocus="">
		<label class="sr-only" th:text="#{login.password}">Password</label>
		<input type="password" class="form-control" name="password"
			   th:placeholder="#{login.password}" required="">
		<div class="checkbox mb-3">
			<!--<label>-->
				<!--<input type="checkbox" value="remember-me"> [[#{login.remember}]]-->
			<!--</label>-->
			<!--<a th:href="@{https://github.com/login/oauth/authorize(client_id=${#httpServletRequest.getServletContext().getAttribute('clientId')},-->
					<!--redirect_uri=${#httpServletRequest.getServletContext().getAttribute('redirectUri')},scope='user',state=1)}"-->
			<a href="https://github.com/login/oauth/authorize?client_id=5e286f2eaee131b02eb4
				&redirect_uri=http://localhost:8081/callback&scope=user&state=1"
				class="btn btn-sm" onclick="doLogin()" role="button">
				<i class="fa fa-github"> </i>
				GitHub 登录
			</a>
			<!--<a class="btn btn-sm" th:href="@{/(l='zh_CN')}"-->
			   <!--th:text="#{login.forget}">Forget password</a>-->
		</div>
		<button class="btn btn-lg btn-primary btn-block" type="submit"
				th:text="#{login.signIn}">Sign in</button>
		<p class="mt-5 mb-3 text-muted">© 2019-2020</p>
		<a class="btn btn-sm" th:href="@{/(l='zh_CN')}">中文</a>
		<a class="btn btn-sm" th:href="@{/(l='en_US')}">English</a>
	</form>
</body>

<script>
    function doLogin() {
        window.localStorage.setItem("toHistory","true");
    }
</script>

</html>